package com.liuchuanzheng.lcz_wanandroid.module.mine.viewmodel

import com.blankj.utilcode.util.BusUtils
import com.jeremyliao.liveeventbus.LiveEventBus
import com.liuchuanzheng.lcz_wanandroid.base.BaseViewModel
import com.liuchuanzheng.lcz_wanandroid.ext.showToast
import com.liuchuanzheng.lcz_wanandroid.module.common.bus.LoginStatusEvent
import com.liuchuanzheng.lcz_wanandroid.module.user.UserManager
import com.liuchuanzheng.lcz_wanandroid.net.common.MainRetrofitManager

/**
 * @author 刘传政
 * @date 2021/9/14 0014 18:20
 * QQ:1052374416
 * 电话:18501231486
 * 作用:
 * 注意事项:
 */
class SettingViewModel : BaseViewModel() {

    fun logout() {
        UserManager.cleanUserInfo()
        MainRetrofitManager.clearCookie()
        showToast("已退出")
        val event = LoginStatusEvent().apply {
            isLogin = false
        }
        LiveEventBus.get(LoginStatusEvent::class.java).post(event)
    }
}